home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-04-08 | 15.9 KB | 297 lines | [TEXT/MPS ] |
-
- ; Created: Wednesday, August 14, 1991 9:33 AM
- ;
- ; File: Components.a
- ;
- ; Assembler Interface to the Macintosh Libraries
- ; Copyright Apple Computer, Inc. 1990-1991
- ; All Rights Reserved
- ;
- ;___________________________________________________________________________
- IF &TYPE('__IncludingComponents__') = 'UNDEFINED' THEN
- __IncludingComponents__ SET 1
-
- gestaltComponentMgr EQU 'cpnt'
-
- kAnyComponentType EQU 0
- kAnyComponentSubType EQU 0
- kAnyComponentManufacturer EQU 0
- kAnyComponentFlagsMask EQU 0
-
- cmpWantsRegisterMessage EQU $80000000
-
- ComponentDescription RECORD 0
- componentType DS.L 1 ; A unique 4-byte code indentifying the command set
- componentSubType DS.L 1 ; Particular flavor of this instance
- componentManufacturer DS.L 1 ; Vendor indentification
- componentFlags DS.L 1 ; 8 each for Component,Type,SubType,Manuf/revision
- componentFlagsMask DS.L 1 ; Mask for specifying which flags to consider in search, zero during registration
- size EQU *
- ENDR
-
- ResourceSpec RECORD 0
- resType DS.L 1 ; 4-byte code
- resId DS.W 1
- size EQU *
- ENDR
-
- ComponentResource RECORD 0
- cd DS ComponentDescription ; Registration parameters
- component DS ResourceSpec ; resource where Component code is found
- componentName DS ResourceSpec ; name string resource
- componentInfo DS ResourceSpec ; info string resource
- componentIcon DS ResourceSpec ; icon resource
- size EQU *
- ENDR
-
- ; Structure received by Component:
- ComponentParameters RECORD 0
- flags DS.B 1 ; call modifiers: sync/async, deferred, immed, etc
- paramSize DS.B 1 ; size in bytes of actual parameters passed to this call
- what DS.W 1 ; routine selector, negative for Component management calls
- params DS.L 1 ; actual parameters for the indicated routine
- size EQU *
- ENDR
-
-
-
- ;*******************************************************
- ;* *
- ;* APPLICATION LEVEL CALLS *
- ;* *
- ;*******************************************************
- ;* Component Database Add, Delete, and Query Routines
- ;*******************************************************
- MACRO
- _RegisterComponent
- MOVEQ #$01,D0
- DC.W $A82A ; TB 002A
- ENDM
-
- MACRO
- _RegisterComponentResource
- MOVEQ #$12,D0
- DC.W $A82A ; TB 002A
- ENDM
-
- MACRO
- _UnregisterComponent
- MOVEQ #$02,D0
- DC.W $A82A ; TB 002A
- ENDM
-
-
- MACRO
- _FindNextComponent
- MOVEQ #$04,D0
- DC.W $A82A ; TB 002A
- ENDM
-
- MACRO
- _CountComponents
- MOVEQ #$03,D0
- DC.W $A82A ; TB 002A
- ENDM
-
-
- MACRO
- _GetComponentInfo
- MOVEQ #$05,D0
- DC.W $A82A ; TB 002A
- ENDM
-
- MACRO
- _GetComponentListModSeed
- MOVEQ #$06,D0
- DC.W $A82A ; TB 002A
- ENDM
-
-
- ;*******************************************************
- ;* Component Instance Allocation and dispatch routines
- ;*******************************************************
- MACRO
- _OpenComponent
- MOVEQ #$07,D0
- DC.W $A82A ; TB 002A
- ENDM
-
- MACRO
- _CloseComponent
- MOVEQ #$08,D0
- DC.W $A82A ; TB 002A
- ENDM
-
-
- MACRO
- _GetComponentInstanceError
- MOVEQ #$0A,D0
- DC.W $A82A ; TB 002A
- ENDM
-
-
- ; direct calls to the Components
- MACRO
- _ComponentFunctionImplemented
- MOVE.L #$0002FFFD,-(A7)
- MOVEQ #$00,D0
- DC.W $A82A ; TB 002A
- ENDM
-
- MACRO
- _GetComponentVersion
- MOVE.L #$0000FFFC,-(A7)
- MOVEQ #$00,D0
- DC.W $A82A ; TB 002A
- ENDM
-
- ;****************************************************
- ;* *
- ;* CALLS MADE BY Components *
- ;* *
- ;******************************************************
- ;******************************************************
- ;* Required Component routines
- ;******************************************************
- kComponentOpenSelect EQU -1 ; ComponentInstance for this open
- kComponentCloseSelect EQU -2 ; ComponentInstance for this close
- kComponentCanDoSelect EQU -3 ; selector # being queried
- kComponentVersionSelect EQU -4 ; no params
- kComponentRegisterSelect EQU -5 ; no params
- kComponentTargetSelect EQU -6 ; ComponentInstance for top of call chain
-
- ;*******************************************************
- ;* Component Management routines
- ;*******************************************************
- MACRO
- _SetComponentInstanceError
- MOVEQ #$0B,D0
- DC.W $A82A ; TB 002A
- ENDM
-
-
- MACRO
- _GetComponentRefcon
- MOVEQ #$10,D0
- DC.W $A82A ; TB 002A
- ENDM
-
- MACRO
- _SetComponentRefcon
- MOVEQ #$11,D0
- DC.W $A82A ; TB 002A
- ENDM
-
-
- MACRO
- _OpenComponentResFile
- MOVEQ #$15,D0
- DC.W $A82A ; TB 002A
- ENDM
-
- MACRO
- _CloseComponentResFile
- MOVEQ #$18,D0
- DC.W $A82A ; TB 002A
- ENDM
-
-
- ;*******************************************************
- ;* Component Instance Management routines
- ;*******************************************************
- MACRO
- _GetComponentInstanceStorage
- MOVEQ #$0C,D0
- DC.W $A82A ; TB 002A
- ENDM
-
- MACRO
- _SetComponentInstanceStorage
- MOVEQ #$0D,D0
- DC.W $A82A ; TB 002A
- ENDM
-
-
- MACRO
- _GetComponentInstanceA5
- MOVEQ #$0E,D0
- DC.W $A82A ; TB 002A
- ENDM
-
- MACRO
- _SetComponentInstanceA5
- MOVEQ #$0F,D0
- DC.W $A82A ; TB 002A
- ENDM
-
-
- MACRO
- _CountComponentInstances
- MOVEQ #$13,D0
- DC.W $A82A ; TB 002A
- ENDM
-
-
- ; useful helper routines for convenient method dispatching
- MACRO
- _CallComponentFunction
- MOVEQ #$FF,D0
- DC.W $A82A ; TB 002A
- ENDM
-
- MACRO
- _CallComponentFunctionWithStorage
- MOVEQ #$FF,D0
- DC.W $A82A ; TB 002A
- ENDM
-
- MACRO
- _DelegateComponentCall
- MOVEQ #$24,D0
- DC.W $A82A ; TB 002A
- ENDM
-
- ; Set Default Component flags
- defaultComponentIdentical EQU 0
- defaultComponentAnyFlags EQU 1
- defaultComponentAnyManufacturer EQU 2
- defaultComponentAnySubType EQU 4
- defaultComponentAnyFlagsAnyManufacturer EQU defaultComponentAnyFlags+defaultComponentAnyManufacturer
- defaultComponentAnyFlagsAnyManufacturerAnySubType EQU defaultComponentAnyFlags+defaultComponentAnyManufacturer+defaultComponentAnySubType
-
- MACRO
- _SetDefaultComponent
- MOVEQ #$1E,D0
- DC.W $A82A ; TB 002A
- ENDM
-
- MACRO
- _OpenDefaultComponent
- MOVEQ #$21,D0
- DC.W $A82A ; TB 002A
- ENDM
-
- MACRO
- _CaptureComponent
- MOVEQ #$1C,D0
- DC.W $A82A ; TB 002A
- ENDM
-
- MACRO
- _UncaptureComponent
- MOVEQ #$1D,D0
- DC.W $A82A ; TB 002A
- ENDM
-
-
- ; errors from component manager & components
- invalidComponentID EQU -3000
- validInstancesExist EQU -3001
- componentNotCaptured EQU -3002
- componentDontRegister EQU -3003
-
- badComponentInstance EQU $80008001
- badComponentSelector EQU $80008002
-
-
- ENDIF ; ...already included